﻿@model ARMS.Models.Customer

@{
    ViewBag.Title = "Create customer";
}

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@{
    ARMS.Models.Shop shop = (ARMS.Models.Shop)ViewData.Eval(ARMS.Controllers.BookingController.CSHOP);
    string shopName = (shop != null) ? shop.name : "";
}

<h2>Create customer</h2>

<div id="shopinfo">
    You are in:<br />
    Shop: @{ @Html.Raw(String.Format("<span>{0}</span>", shopName)); }
</div>

@Html.ValidationSummary(true, "Please correct the errors and try again.")

@using(Html.BeginForm("Save", "Customer")) 
{
<fieldset>
    <div class="detail">
    @{
        @Html.LabelFor(m => m.id);
        if (Model.id < 1)
        {
            @Html.Raw("<span>NEW</span>")
            @Html.HiddenFor(m => m.id);
        }else{
            @Html.TextBoxFor(m => m.id)
        }
        @Html.Raw("<br />")

        @Html.LabelFor(m => m.Firstname)
        @Html.TextBoxFor(m => m.Firstname)
        @Html.ValidationMessageFor(m => m.Firstname)
        @Html.Raw("<br />")

        @Html.LabelFor(m => m.Lastname)
        @Html.TextBoxFor(m => m.Lastname)
        @Html.ValidationMessageFor(m => m.Lastname)
        @Html.Raw("<br />")

        @Html.LabelFor(m => m.Address)
        @Html.TextAreaFor(m => m.Address)
        @Html.Raw("<br />")
 
        @Html.LabelFor(m => m.Mobile)
        @Html.TextBoxFor(m => m.Mobile)
        @Html.Raw("<br />")

        @Html.LabelFor(m => m.Telephone)
        @Html.TextBoxFor(m => m.Telephone)
        @Html.Raw("<br />")
        
        @Html.LabelFor(m => m.Email)
        @Html.TextBoxFor(m => m.Email)
        @Html.Raw("<br />")
 
        @Html.LabelFor(m => m.MemberNo)
        @Html.TextBoxFor(m => m.MemberNo)

        @Html.HiddenFor(m => m.shopid);
        @Html.Raw("<br />");
    }
    </div>
    <div class="detail buttons">
        <button class="dialog-btn" id="cancel" type="button" value="Cancel">@{@Html.ActionLink("Cancel", "Index", "Customer");}</button>
        <button class="dialog-btn" id="save" type="submit" value="Save">Save</button>
    </div>
</fieldset>
    <div class="instruction clear">
        * Please note that all the fields with asterisks are required values.<br />
        If you would like to change the the customer create new booking, this one can be canceled insted.
    </div>
}

